/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2022-12-17
 * Time: 16:10
 */
public class PrintMostNum {
    public static int printMostNum(int[] array) {
        int n = array.length / 2;
        int[] array1 = new int[10];
        for (int i = 0; i < array.length; i++) {
            array1[array[i]]++;
        }
        for (int i = 0; i < array1.length; i++) {
            if(array1[i] > n && array1[i] != 0) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        int[] array = new int[]{3,2,3};
        System.out.println(printMostNum(array));
    }
}
